<script setup lang="ts">
import { ref } from 'vue'

const props = defineProps({
    activeTab: {
        type: Number,
        default: 0
    }
});
const image = document.getElementById('image');
const emit = defineEmits(['update:activeTab']);

const handleClick = (index: number) => {
    emit('update:activeTab', index);
};
</script>

<template>
    <div class="home-tab">
        <div class="tab-item" :class="{ active: activeTab === 0 }" @click="handleClick(0)">
            <img v-if="activeTab === 0" src="@/assets/麦穗左@3x.png" alt="tab-item-left" class="item-img-left">
            <img v-else src="@/assets/麦穗左-未选中@3x.png" alt="tab-item-left" class="item-img-left">

            <div class="tab-item-title">甄选好品牌</div>
            <div class="tab-item-description">火热进行中</div>
            <img v-if="activeTab === 0" src="@/assets/麦穗右@3x.png" alt="tab-item-right" class="item-img-right">
            <img v-else src="@/assets/麦穗右-未选中@3x.png" alt="tab-item-right" class="item-img-right">
        </div>
        <div class="tab-item" :class="{ active: activeTab === 1 }" @click="handleClick(1)">
            <img v-if="activeTab === 1" src="@/assets/麦穗左@3x.png" alt="tab-item-left" class="item-img-left">
            <img v-else src="@/assets/麦穗左-未选中@3x.png" alt="tab-item-left" class="item-img-left">
            <div class="tab-item-title">品牌榜发布</div>
            <div class="tab-item-description">12月25日揭晓</div>
            <img v-if="activeTab === 1" src="@/assets/麦穗右@3x.png" alt="tab-item-right" class="item-img-right">
            <img v-else src="@/assets/麦穗右-未选中@3x.png" alt="tab-item-right" class="item-img-right">
        </div>
    </div>
</template>

<style scoped>
.home-tab {
    position: relative;
    display: flex;
    /* justify-content: space-between; */
    align-items: center;
    width: 702px;
    height: 112px;
    margin: 0 auto 24px;
    background: #CB1437;
    border: 1px solid #F05A5A;
    box-shadow: inset 0 0 10px 0 #AD0202;
    border-radius: 56px;
    z-index: 3;
    /* margin:o auto; */

}

.tab-item {
    position: relative;
    align-items: center;
    margin: 8px;
    width: 332px;
    height: 96px;
    text-align: center;
    color: #FFFFFF;

    img {
        position: absolute;
        top: 30px;
        width: 28px;
        height: 43px;
    }

    .item-img-left {
        left: 59px;
    }

    .item-img-right {
        right: 59px;
    }
}

.tab-item-title {
    margin-top: 10px;
    font-family: PingFangSC-Semibold;
    font-size: 30px;
    font-weight: bold;
    line-height: 42px;
    letter-spacing: 0;
    text-align: center;
}

.tab-item-description {
    margin-top: 2px;
    font-family: PingFangSC-Regular;
    font-size: 24px;
    line-height: 33px;
    letter-spacing: 0;
}

.active {
    background-image: linear-gradient(179deg, #FFF1E1 0%, #FFD6AE 47%, #FFB875 98%);
    border-radius: 50px;
    border-radius: 50px;
    color: #975623;
}
</style>
